<template>
	<view class="centerFeedback">
		<view class="centerFeedback-main">
			<textarea class="centerFeedback-main-tear" v-model="content" value=""placeholder-class="inputplace" placeholder="请详细描述您的问题，我们将尽快为您解决。" />
		</view>
		<view class="centerFeedback-btn">
			<view class="centerFeedback-btn-box font_blod" @click="cli_btn">
				提交
			</view>
		</view>
	</view>
</template>

<script>
	import allapi from '../api/index.js'
	export default {
		data() {
			return {
				agentId: uni.getStorageSync('agentId'),
				content: '',
			}
		},
		methods: {
			// 点击保存
			cli_btn () {
				let content = this.content
				if (content) {
					this.saveFeedBack()
				}else {
					uni.showToast({
						title: '请详细描述您的问题，我们将尽快为您解决。',
						icon: 'none'
					})
				}
			},
			// 保存意见反馈
			saveFeedBack () {
				uni.request({
					url: allapi.saveFeedBack,
					data: {
						agentId: this.agentId,
						content: this.content
					},success: (res) => {
						console.log(res);
						uni.showToast({
							title: res.data.msg,
							icon: 'none'
						})
						setTimeout( function () {
							uni.navigateBack()
						},500)
					}
				})
			}
		}
	}
</script>

<style scoped>
	.centerFeedback {
		position: absolute;
		width: 100%;
		height: 100%;
		left: 0;
		top: 0;
		display: flex;
		flex-direction: column;
	}
	.centerFeedback-main {
		flex: 1;
	}
	.centerFeedback-main-tear {
		width: 656rpx;
		margin-left: 24rpx;
		margin-top: 24rpx;
		padding: 24rpx;
		height: 400rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}
	.centerFeedback-btn {
		margin: 40rpx;
	}
	.centerFeedback-btn-box {
		height: 92rpx;
		background: linear-gradient(90deg, #2ACE52 0%, #1DC248 100%);
		border-radius: 46rpx;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 92rpx;
	}
</style>
